package com.kuang.springcloud.controller;

import com.kuang.springcloud.pojo.Dept;
import com.kuang.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @项目名称：springcloud
 * @包名：com.kuang.springcloud.config
 * @类名称：DeptConsumerController
 * @类描述：
 * @创建人：liux @创建时间：2021年08月27日  15:26
 * @修改人：liux @修改时间：2021年08月27日  15:26
 * @修改备注
 * @版本信息：v1.0
 */
@RestController
public class DeptConsumerController {
    @Autowired
    private DeptClientService deptClientService;

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id){
        return deptClientService.queryById(id);
    }
    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return  deptClientService.addDept(dept);
    }
    @RequestMapping("/consumer/dept/list")
    public List<Dept> list (){
        return deptClientService.queryAll();
    }
}
